﻿$(function () {
    $('.navi-left').find('.datebox').css('width', '100px');
});
function newcreate(name) {
    //模态窗口
    if (window.showModalDialog != null) {
        window.showModalDialog(""+name+".html", { name: name }, 'dialogWidth=' + (window.screen.availWidth - 10)
+ 'px;dialogHeight=' + (window.screen.availHeight - 70) + 'px;dialogTop=0px;dialogLeft=0px;resizable=1;status=no;menubar=no;scroll=yes;location=no;resizable=no;internate=no;titlebar=no;');
    } else {
        window.open("" + name + ".html", name, 'width=' + (window.screen.availWidth - 10)
       + ',height=' + (window.screen.availHeight - 70) + ',top=0,left=0,resizable=1,status=yes,menubar=no,scrollbars=yes,location=no,resizable=no');
    }
}
function getdefalutTab(defalutName)
{
    $('.textClass').find('.tab_menu').each(function () {
        var self = $(this).attr('title').trim();
        if (self != defalutName) {
            $(this).css('display', 'none');
        }
    });
    $("#divChange").find('.XOil').each(function () {
        var self = $(this).attr('id').trim();
        if (self != "XSaveOil") {
            $(this).css('display', 'none');
        }
    });
}
function getDateChange() {
    if ($('.info_content').find('.datebox')) {
        var dateList = $('.info_content').find('.datebox');
        for (var i = 0; i < dateList.length; i++) {
            if ($(dateList[i]).parent().find('>input').length == 2) {
                $($(dateList[i]).parent().find('.datebox')[0]).css({ 'width': '90px', 'margin-left': '5px' });
                $($(dateList[i]).parent().find('.datebox')[1]).css({ 'width': '90px' });
            } else {
                $($(dateList[i]).parent().find('.datebox')[0]).css({ 'width': '188px', 'margin-left': '5px' });
            }
        }
    }
}
function getInfoChange() {
    $('#getChangeInfo').bind('change', function () {
        var me = $(this).val().trim();
        var divData = $('#divChange').find('>div');
        for (var i = 0; i < divData.length; i++) {
            if ($(divData[i]).attr('id').trim() == me) {
                $(divData[i]).get(0).style.display = "block";
            } else {
                $(divData[i]).get(0).style.display = "none";
            }
        }
    });
}
function myformatter(date) {
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    var d = date.getDate();
    return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
}
function myparser(s) {
    if (!s) return new Date();
    var ss = (s.split('-'));
    var y = parseInt(ss[0], 10);
    var m = parseInt(ss[1], 10);
    var d = parseInt(ss[2], 10);
    if (!isNaN(y) && !isNaN(m) && !isNaN(d)) {
        return new Date(y, m - 1, d);
    } else {
        return new Date();
    }
}
function getUrlPage(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return decodeURI(r[2]);
    return null;
};